/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Model;

import Controller.Ville;
import java.sql.Connection;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;


public class VilleDAO extends AbstractDAO<Ville>{
    
    public VilleDAO(Connection connect) 
    {
        super(connect);
    }

    @Override
    protected boolean insert(Ville obj) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    protected boolean update(Ville obj) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    protected boolean delete(Ville obj) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public Ville findById(int id) {
        
        Ville ville = new Ville();
        try{
        ResultSet result = this.connect.createStatement(
        ResultSet.TYPE_SCROLL_INSENSITIVE,
        ResultSet.CONCUR_READ_ONLY).executeQuery("SELECT * FROM ville WHERE idV = "+id);
        
        if(result.first()){
            ville.setId(result.getInt(1));
            ville.setNom(result.getString(2));
            ville.setCP(result.getInt(3));
        }
            
        }catch (Exception e){
            
        }
        return ville;
    }
}
